import 'package:flutter/cupertino.dart';
import 'package:mobile_app.core/core/presentation/widgets/shake_built_transition.dart';
import 'package:mobile_app.home.core/core/presentation/widgets/base_keyboard_text_field.dart';

class ShakeableKeyboardTextField extends StatelessWidget {
  const ShakeableKeyboardTextField({
    required this.shakeAnimationController,
    this.placeholderColor,
    this.placeholder,
    this.color,
    this.controller,
    this.focusNode,
    this.onSubmitted,
    this.textInputAction,
    this.autocorrect = true,
    this.enableSuggestions = true,
    this.enableInteractiveSelection = true,
    this.keyboardType = TextInputType.text,
    this.showCursor = true,
    this.textColor,
    super.key,
  });

  final AnimationController shakeAnimationController;
  final Color? placeholderColor;
  final String? placeholder;
  final Color? color;
  final TextEditingController? controller;
  final FocusNode? focusNode;
  final VoidCallback? onSubmitted;
  final TextInputAction? textInputAction;
  final bool autocorrect;
  final bool enableSuggestions;
  final bool enableInteractiveSelection;
  final TextInputType keyboardType;
  final bool showCursor;
  final Color? textColor;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: color,
      child: ShakeBuiltTransition(
        controller: shakeAnimationController,
        child: BaseKeyboardTextField(
          placeholderColor: placeholderColor,
          placeholder: placeholder,
          color: color,
          controller: controller,
          focusNode: focusNode,
          onSubmitted: onSubmitted,
          textInputAction: textInputAction,
          autocorrect: autocorrect,
          showCursor: showCursor,
          enableInteractiveSelection: enableInteractiveSelection,
          enableSuggestions: enableSuggestions,
          keyboardType: keyboardType,
          textColor: textColor,
        ),
      ),
    );
  }
}
